/**
* AutoSWF - Cody Cushing. March 26, 2009
* Copyright (c) 2009 Cody Cushing
* No use restrictions. Maintain this notice in all versions. 
**/

package com.autoswf.core
{
	import flash.events.Event;
	
	import flexunit.framework.Assert;
	import flexunit.framework.TestCase;

	public class ChainLinkDispatcherTest extends TestCase
	{
		public function ChainLinkDispatcherTest(methodName:String=null)
		{
			super(methodName);
		}
		
		/**
		 * Tests that an event being passed up the chain will get dispatched if it passes 
		 * through a ChainLinkDispatcher.
		 */		
		public function testEventsAreDispatched():void
		{
			var handler:Function = function(event:Event):void
			{
				assertStrictlyEquals(testEvent, event);
			}
			
			var testEvent:Event = new Event(Event.CHANGE);
			var chainLink:ChainLinkDispatcher = new ChainLinkDispatcher("link");
			chainLink.addEventListener(Event.CHANGE, addAsync(handler, 20));
			chainLink.sendUpChain(new Transport(testEvent));
		}
		
	}
}